package cn.regentsoft.controller;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class Test {

    public static void main(String[] args) {


        String sql=null;
        sql="SELECT pn.id AS nodeId," +
                "                pn.name AS nodeName," +
                "                fmpn.id AS missionNodeId," +
                "                su.id AS chargerId," +
                "                su.user_name AS chargerName," +
                "                fm.id AS missionId," +
                "                fm.order_no AS orderNo," +
                "                gu.style_no AS styleNo," +
                "                fmpn.labour_cost AS labourCost," +
                "                fmpnrq.id AS qId," +
                "                IFNULL(fmpnrq.quantity, 0) AS qs," +
                "                fmpnrd.id AS dId," +
                "                fmpnrd.id IS NOT NULL AS ds," +
                "                fmpnrw.id AS wId," +
                "                fmpnrw.id IS NOT NULL AS ws," +
                "                fmpn.status AS status," +
                "                fmpn.date_end AS dateEnd," +
                "                fm.actual_cutting_completed && (" +
                "                IFNULL(fmpn.doac, FALSE) || IFNULL(" +
                "                fmpn.is_associate_wym," +
                "                        FALSE" +
                "                      )" +
                "                    ) AS actualCutting," +
                "                    IFNULL(" +
                "                      (" +
                "                         SELECT" +
                "                          sum(fmd.num)" +
                "                        FROM" +
                "                          factory_mission_detail AS fmd" +
                "                        WHERE" +
                "                          fmd.mission_id = fm.id" +
                "                      )," +
                "                      0" +
                "                    ) AS total," +
                "                    IFNULL(" +
                "                      (" +
                "                        SELECT" +
                "                          sum(fmpstq.quantity)" +
                "                        FROM" +
                "                          fac_mission_prcd_sku_target_quantity AS fmpstq" +
                "                        WHERE" +
                "                          fmpstq.fac_mission_id = fm.id" +
                "                      )," +
                "                      0" +
                "                    ) AS acTotal" +
                "                  FROM" +
                "                    fac_mission_prcd_node AS fmpn" +
                "                  INNER JOIN prcd_node AS pn ON fmpn.prcd_node_id = pn.id" +
                "                  AND pn.time_deleted = 0" +
                "                  INNER JOIN fac_mission_prcd_node_report AS fmpnr ON fmpn.id = fmpnr.fac_mission_prcd_node_id" +
                "                  AND fmpnr.time_deleted = 0" +
                "                  LEFT JOIN fac_mission_prcd_node_report_qualified AS fmpnrq ON fmpnr.id = fmpnrq.fac_mission_prcd_node_report_id" +
                "                  LEFT JOIN fac_mission_prcd_node_report_defectived AS fmpnrd ON fmpnr.id = fmpnrd.fac_mission_prcd_node_report_id" +
                "                  AND fmpnrd.status IN (0, 2)" +
                "                  AND fmpnrd.time_deleted = 0" +
                "                  LEFT JOIN fac_mission_prcd_node_report_wasted AS fmpnrw ON fmpnr.id = fmpnrw.fac_mission_prcd_node_report_id" +
                "                  INNER JOIN sys_user AS su ON fmpnr.charger_id = su.id" +
                "                  INNER JOIN factory_mission AS fm ON fmpn.fac_mission_id = fm.id" +
                "                  INNER JOIN goods_unit AS gu ON fm.goods_id = gu.id" +
                "                  WHERE" +
                "                    pn.unit_id = :unitId" +
                "                  AND su.id IN (:staffIds)";






    }
    
    
    
    
    
}
